package com.itheima.a07regexdemo1;

public class RegexDemo6 {
    public static void main(String[] args) {
        //按照正则表达式去替换和切割字符串
        String str="嘿嘿aji_a嘻嘻aksjaiw哈哈jsikaq";

        //替换
        String string = str.replaceAll("\\w+","a");
        System.out.println(string);//嘿嘿a嘻嘻a哈哈a

        //切割
        String[] split = str.split("\\w+");
        for (int i = 0; i < split.length; i++) {
            System.out.print(split[i]+" ");//嘿嘿 嘻嘻 哈哈
        }

    }
}
